package com.gr3g.dev.learndraw.model.draw;

import android.graphics.Path;

import com.gr3g.dev.learndraw.model.IPath;

/** @author Gregory Tardivel */
public final class Line implements IPath {

    private int x1;
    private int y1;
    private int x2;
    private int y2;

    /** @return the x1 */
    public int getX1() {
        return this.x1;
    }

    /** @param pX1 the x1 to set */
    public void setX1(final int pX1) {
        this.x1 = pX1;
    }

    /** @return the y1 */
    public int getY1() {
        return this.y1;
    }

    /** @param pY1 the y1 to set */
    public void setY1(final int pY1) {
        this.y1 = pY1;
    }

    /** @return the x2 */
    public int getX2() {
        return this.x2;
    }

    /** @param pX2 the x2 to set */
    public void setX2(final int pX2) {
        this.x2 = pX2;
    }

    /** @return the y2 */
    public int getY2() {
        return this.y2;
    }

    /** @param pY2 the y2 to set */
    public void setY2(final int pY2) {
        this.y2 = pY2;
    }

    @Override
    public Path getPath(final float width, final float height) {
        final Path retour = new Path();
        retour.moveTo(this.x1 * width / 100, this.y1 * height / 100);
        retour.lineTo(this.x2 * width / 100, this.y2 * height / 100);
        return retour;
    }

    @Override
    public String toString() {
        return "Line";
    }

}
